import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        count: 0
    },
    getters: {},
    mutations: {
        add(state) {
            state.count++
        },
        reduce(state) {
            state.count--
        },
        adds(state) {
            state.count++
        },
        reduces(state) {
            state.count--
        },
    },
    actions: {
        adds(context) {
            setTimeout(() => {
                context.commit('adds')
            }, 1000);
        },
        reduces(context) {
            setTimeout(() => {
                context.commit('reduces')
            }, 1000);
        },
    },
    modules: {}
})